package com.Algorithm.Study.ThinkTest;
/*
 *
 * 选择
 * 1.将一个数固定,然后比较,出现比他小的交换一下
 * --- 它会每次走一轮不用管之前的固定位,内for控制
 *
 *
 * */
public class SelectSortTest {
    public static void main(String[] args) {
            int min = 0;
            int arr[] = new int[]{66,3,45678,76544,3453,23,1};


            // [----------------] [去掉第一--------------]

            for (int i = 0; i < arr.length; i++) {
                for (int j = i; j < arr.length; j++) {
                    if(arr[i]>arr[j]){
                        int m = arr[i];
                        arr[i] = arr[j];
                        arr[j] = m;
                    }
                }
            }

            for (int i : arr) {
                System.out.print(i + " ");
            }




            // 单轮
            int arr1[] = new int[]{66,3,45678,76544,3453,23,1};
            for (int j = 0; j < arr1.length; j++) {

                if(arr1[0]>arr1[j]){
                    int m = arr1[0];
                    arr1[0] = arr1[j];
                    arr1[j] = m;
                }
            }

            System.out.println();
            for (int i : arr1) {
                System.out.print(i + " ");
            }


        }
}
